<!--
 * @Author: WangZhiYu <w19165802736@163.com>
 * @Date: 2025-04-22 09:40:50
 * @LastEditTime: 2025-04-22 13:37:55
 * @LastEditors: WangZhiYu <w19165802736@163.com>
 * @Descripttion: 
-->
<template>
  <div class="share1">
    <div class="share1-header">
      <!-- <img class="share1Logo" src="@/assets/img/shareLogo.png" alt="" /> -->
      <span>{{ projectName }}</span>
    </div>
    <div class="headerImg">
      <img src="@/assets/img/shareBgc.jpg" alt="" />
    </div>
    <div class="resouseData">
      <!-- <p class="resouseTitle">视频入口</p> -->
      <div class="resouseList">
        <div class="resouseItem" v-for="item in videoData" @click="goShare2(item)">
          <img v-if="item.headImg" :src="item.headImg" alt="" />
          <img v-else src="@/assets/img/shareBgc.jpg" alt="" />
          <p class="itemTitle">
            {{ item.name }}
            <span class="videoLength">{{ item.items.length }}</span>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      videoData: [],
      projectName: '',
    };
  },
  created() {
    try {
      this.videoData = Object.values(this.$route.query);
      this.videoData.forEach(item => {
        console.log(item, 'item');
        if (typeof item === 'string') throw '获取数据错误';
      });
    } catch (error) {
      const localItem = localStorage.getItem('videoData1');
      if (localItem) {
        this.videoData = JSON.parse(localItem);
      }
    }
    localStorage.setItem('videoData1', JSON.stringify(this.videoData));
    this.projectName = this.$route.params.name;
    if (this.videoData[0]) {
      this.currentProject = this.videoData[0].ID;
    }
  },
  methods: {
    goShare2(item) {
      this.$router.push({ path: `/share2/${this.projectName}`, query: [{ items: item.items }] });
    },
  },
  computed: {},
};
</script>
<style>
.share1-header {
  width: 100%;
  height: 60px;
  border-bottom: 1px solid #30323b;
  box-sizing: border-box;
  line-height: 60px;
}
.headerImg {
  width: 100%;
}
.headerImg img {
  width: 100%;
}
.resouseData {
  color: #fff;
  margin-top: 5px;
  padding: 0 20px;
}
.resouseTitle {
  text-align: center;
  font-size: 24px;
  letter-spacing: 3px;
}
.resouseList {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: 5px;
}
.resouseItem {
  width: 48%;
  margin-top: 13px;
}
.resouseItem img {
  width: 100%;
}
.itemTitle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  padding: 0 5px;
}
.videoLength {
  color: rgb(153, 153, 153);
}
</style>
